home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / love4th.zip / SOURCE.DOC < prev    next >
Text File  |  1991-10-01  |  11KB  |  212 lines

  1. Compiling source code
  2. ---------------------
  3.         LOVE Forth allows considerable flexibility in the form of source
  4. code accepted.   Programs can be loaded from screen format floppy disks,
  5. or screen files and text files under MS-DOS.  These may be intermixed as
  6. desired and nested within each other up to ten levels deep.
  7.  
  8.         Many file words are named with a quote following (eg. INCLUDE",
  9. OPEN" ).  These words are followed by a file name, or a path and file
  10. name (eg.  INCLUDE" MYFILE.TXT" or OPEN" \WORK\SCREENS\PROG.SCR").
  11. There should always be a closing quote (it may be omitted when it is the
  12. last item on a line that has been keyed in).  The word "CLOSE however,
  13. does not use a name.   In this article the words block and screen are
  14. used interchangably, both meaning a 1024 character fixed unit of disk
  15. storage.
  16.  
  17.         In order to load source code from screen format files or floppy
  18. disks, the block handling words must be loaded.  To load them type:
  19. INCLUDE" LOADBLK.TXT" .  Once loaded they may NOT be removed as some
  20. kernel words are REDEFINEd.
  21.  
  22. Loading MS-DOS text files
  23. -------------------------
  24.         Text files are convenient and efficient in use of disk space.
  25. Therefore L.O.V.E. Forth accepts source code from text files.   The word
  26. INCLUDE" followed by MS-DOS path and file name, loads the specified
  27. file.  There is a file size limit of 65535 bytes.
  28.  
  29.         There are two ways available for convenient text editing during
  30. development.  Pop-up editors are the most convenient method of editing
  31. source.  Simply perform an interim saving of the work-file, exit the
  32. editor, and load.  Most pop-up editors, however, are fairly limited.
  33. Stand-alone editors are accomodated by the LOVE Forth 'dos' command.
  34. Typing DOS followed by the path and name of the desired text editor,
  35. begins an editing session.  To return to Forth, simply save the work,
  36. exit the editor, and load the desired file.
  37.  
  38.         There are several methods of commenting available in text files.
  39. The usual Forth comment ( ) works to a length of 256 characters.  The
  40. line comment function \ works for one line (until carriage return is
  41. encountered).  To comment out large portions of the text the words (( and
  42. )) are available.  They may enclose any amount of space, and may be used
  43. around ( ) and \ .   They may not be nested within themselves.  To
  44. comment from one point to the end of the file, simply use (( without
  45. providing a closing )).   Note that )) is a forth word and must be
  46. surrounded by spaces or end of line.
  47.  
  48.         The word EXIT is often used to exit from the compilation of
  49. a Forth screen.  It may not be used for this function in
  50. text files.   Simply use (( as is described above.   In addition, the
  51. words --> , LOAD  and  THRU  may not appear (LOAD" and THRU" may be used
  52. to load screens from another file, however).
  53.  
  54.         It is possible to load a screen file with INCLUDE" .  In this
  55. case, however, it must not include any of the words described above or
  56. the Forth line comment \ .
  57.  
  58.         If an error occurs while loading a text file, the previous
  59. twenty-four successfully loaded lines are displayed, and the erroneous
  60. word is highlighted.
  61.  
  62. Using screen files
  63. ------------------
  64.         L.O.V.E. Forth supports editing and loading of screen files.  A
  65. comprehensive screen editor and numerous utilities for screen handling
  66. are supplied.  The maximum file size accomodated is 32767 screens.
  67.  
  68.         The word OPEN" followed by a filename, opens an existing screens
  69. file for editing.  It becomes the 'current' file, which is accessed by
  70. block disk words such as BLOCK, UPDATE, .LINE etc.
  71.  
  72.         To display to contents of a screen on the display, there is a
  73. fast LISTing utility.  Type:   (screen-no) L   to list a screen.  The
  74. words LN, LB list one screen forward and backward respectively, LL
  75. relists the current screen.   The word EL enters the full-screen screen
  76. editor at the current screen.
  77.  
  78.         The screen editor is a virtual vocabulary.  It may be entered at
  79. the current screen with EL or by:  (screen-no) EDIT .  Typing control-X
  80. displays the help information.  This editor provides facilities for
  81. general editing, 'gobbling' lines or words to a buffer, and moving from
  82. screen to screen.  To save the screen and exit from the editor, type:
  83. escape and 'F'.   Note that the 'gobble' buffers are lost if any
  84. compiling is performed, or if another virtual vocabulary is called in.
  85. Do not use the editor on a write-protected disk, as it always writes the
  86. current screen when moving between screens.
  87.  
  88.         To load from the current file, the words LOAD and THRU may be
  89. used. It is possible to load right from the editor by typing escape L .
  90. Arrow  -->  may be included to proceed to the next screen and EXIT may
  91. be used to terminate loading at a point on a screen.  If any error
  92. occurs during loading, the erroneous screen becomes the current screen
  93. for listing and editing.  The word WHERE will display the screen with
  94. the erroneous word highlighted.
  95.  
  96.         The word SHOW performs the rapid listing of a range of screens.
  97. To slow it down, store a value into the variable SHOWDELAY.   INDEX
  98. prints the first line only, from a range of screens.
  99.  
  100.         To create a new screens file, the word OPEN-NEW" followed by a
  101. path and file name is used.  It gives the file a starting size of two
  102. screens.  To obtain a larger file size, type:  (total screens) SCREENS .
  103. When in the editor, the file can also be extended, simply by advancing
  104. past the last screen in the file.  To open a different file, simply use
  105. OPEN" or OPEN-NEW".  The previous file is automatically closed.  To
  106. close the file explicitly, the word "CLOSE may be used (no word
  107. preceeds it).
  108.  
  109.         To copy a range of screens from one place on disk to another the
  110. word COPYSCRNS may be used.  Pass in the starting screen, ending screen
  111. and destination screen.  Screens may be 'slid up' or down in the current
  112. file.  To erase a range of screens, the word ERASESCRNS is used (pass in
  113. start and end screens).  To put a header, with date time and screen
  114. number on a range of screens, use the word SCRNHDS.
  115.  
  116.         To copy screens from file to file, the word COPYF->F" is used.
  117. Pass in the starting screen and ending screen in the source file, and
  118. the first destination screen in the destination file.  Follow this word
  119. with the source path\file and the destination path\file. For example:
  120.  
  121.         0 10 5 COPYF->F" \my-dir\file1.scr"myfile.scr"
  122.         There should be no space following the second " mark.
  123.  
  124.         To load a screen or range of screens from any screen file, the
  125. words LOAD" and THRU" may be used.  The values passed in are the same as
  126. for LOAD and THRU, but the screens are loaded from the specified file.
  127. The words -->, LOAD, THRU may be used in the loaded file and operate
  128. within that file.  Additional files may be loaded from within those
  129. files with additional INCLUDE", LOAD" or THRU" commands.
  130.  
  131.         If an error occurs while loading a screens file, that file is
  132. left open for editing at the errorneous screen.  If an error occurs
  133. while loading a text file, no file is left open for editing.  If there
  134. are no errors, the file currently open before the loading, remains so.
  135.  
  136.         Screen files may be converted to text files for more convenient
  137. programming.  The free-ware program   BUNBLOCK.EXE  is provided for
  138. this purpose.  Type BUNBLOCK with no arguments for help.
  139.  
  140. Using screens format diskettes
  141. ------------------------------
  142.         The traditional Forth source code storage is on floppy disks
  143. dedicated entirely to sequential screens. L.O.V.E. Forth supports both
  144. editing and loading of eight and ten sector formats.  Disks are accessed
  145. by bypassing MS-DOS.  Hard disks are not accessed.  There are also
  146. several utilities for conversion of screen floppies to screen files.
  147. The screen format facility must be explicitly enabled before use, as
  148. follows.
  149.  
  150.         When no screen file is open, Forth accesses the floppy disks in
  151. screen format.  All the block disk words and utilities described
  152. above may be used (LOAD, THRU, -->, SHOW, INDEX, WHERE, COPYSCRNS,
  153. ERASESCRNS).  In addition the words LOAD", THRU", and INCLUDE" may
  154. appear on screens format diskette screens.
  155.  
  156.         There are two formats of screens floppy available.  8 sectors
  157. per track and 10 sectors per track (320 or 400k per disk).  The former
  158. is the default setting.  To switch to and from 10 sectors format the
  159. commands 10-SECTS-ON and 10-SECTS-OFF are used (in SCREEN-UTILS
  160. vocabulary).  Floppy drives are treated as having contiguous screens.
  161. Screen 319 (399) is the last screen on drive A:, and screen 320 (400)
  162. is the first on drive B:.   Note that accesses to floppies through
  163. MS-DOS functions confuse the screens format utilities (sets them to 9
  164. sectors/track).  Two solutions to this: Refrain from using floppies for
  165. MS-DOS functions, or switch to screen files.  Using virtual
  166. vocabularies from MS-DOS floppies will not cause problems.
  167.  
  168.         While a screens file is in use, and it is desired to list a
  169. single screen on a screens format floppy, use the command: (scrn_no)
  170. LSCRN .  To copy from a screens format floppy to a screens file, the
  171. command COPYSCRNS->F" followed by the path\file of an existing file is
  172. used.  The starting screen, ending screen, and destination screen are
  173. passed in.   It is also possible to copy from a screens file to floppy
  174. screens with the command:  COPYF->SCRNS" followed by the source file,
  175. and with similar arguments passed in.
  176.  
  177.         INITDISK will initialize a screens format floppy disk to the
  178. current sectors/track setting.  This word normally initializes drive B:.
  179. To initialize drive A: execute the word SETDRIVES, which prompts for the
  180. drive to use.  The word COPYDISK, copies the entire disk from drive A:
  181. to B:, and the word COMPDISK compares the two (two drives are required
  182. for both words).  The word COPYNEW initializes drive B:, copies drive
  183. A: to B: and compares the two.
  184.  
  185.         The variable BLKMAX is used with screens format diskettes to set
  186. the maximum available screen.  If it is desirable to limit the action of
  187. editing, listing etc,  set this variable to the last usable block#.  The
  188. variable OFFSET is also used primarily with screens format diskettes.
  189. Its contents are simply added to the block number on block operations.
  190. For example, to make screen 0 refer to the first block on drive B,
  191. type:  0 ONB OFFSET !
  192.  
  193.         Normally usage of screens floppy diskettes is disabled.  To
  194. enable the usage of these obsolete media, type:
  195.         SCREEN-UTILS ENABLE-SCRNS .
  196. To disable use:
  197.         SCREEN-UTILS DISABLE-SCRNS .
  198. These changes may be made permanent by doing a SAVE" of the Forth
  199. system.
  200.  
  201. Nested loading capability
  202. -------------------------
  203. L.O.V.E. Forth allows files to be loaded from within other files.
  204. This permits screen files and text files to be intermixed and
  205. nested ten levels deep.  Simply include the appropriate loading
  206. word (eg.  LOAD" or INCLUDE" ) in a screen or file.
  207.  
  208.                               Load the following:
  209.                          Screen disk:   Screen file   Text file:
  210. From:   Screen disk          *              *             *
  211.         Screen file                         *             *
  212.         Text file                           *             *